<div class="block-news">
<?
//bắt dữ liệu từ search
foreach ($_POST as $key => $test){
    if ($test == 0){
        unset($_POST[$key]);
    }else{
        $_POST[$key] = killInjection($_POST[$key]);
    }
}
$post_array = '';
$post_array = $_POST;
if ($post_array)
{
    $count = count($post_array);
    $comma_separated = implode(", ", $post_array);
    $first_sql = mysql_query("SELECT count(product_id) AS count_loop, product_id FROM `xteam_product_extend` WHERE properties_id IN (" .$comma_separated . ") GROUP BY product_id HAVING count_loop = " . $count . "");
    if ($first_sql){
        while ($row = mysql_fetch_assoc($first_sql)){
            $row_id[] = $row['product_id'];
        }
        if ($row_id){
            $row_id = implode(", ", $row_id);
        }
    }
    if ($row_id != ''){
        $result = mysql_query("SELECT * FROM xteam_product WHERE id IN (". $row_id .") ORDER BY is_hot DESC,date_added DESC, sort ASC");
        if ($result){
            $num = 0;
            while ($row = mysql_fetch_assoc($result)){
                $properties = product_properties($row['id']);
                $num++;
                $class = $num % 2 != 0 ? "block-left" : "block-right";
                if ($parid[$row['parent_id']] % 2 == 0){
                    $class_sp = "rental";
                }else{
                    $class_sp = "salse";
                }?>
            <div class="<?=$class?>">
                <h2 class="title-news">
                    <?=$row['is_hot']==1?'<img src="'.$curHost.'images/hot.gif" alt="'.utf8_to_ascii($row['name']).'" />':''?>
                    <a href="<?=$curHost.str_replace(array('--','--'), '-', utf8_to_ascii($parname[$row['parent_id']])).'/'.str_replace(array('--','--'), '-', utf8_to_ascii($parseokey[$row['parent_id']]))?>/7/<?=$parid[$row['parent_id']]?>.html">
                        <span class="<?=$class_sp?>"><?=$parname[$row['parent_id']]?> | </span>
                    </a>
                    <a href="<?=$curHost. utf8_to_ascii($parent=$parseokey[$row['parent_id']]!=''?$parseokey[$row['parent_id']]:$parname[$row['parent_id']])?>/<?=str_replace(array('--','--'), '-', utf8_to_ascii($name=$row['seo_key']!=''?$row['seo_key']:$row['name']))?>/1/<?=$row['id']?>.html" title="<?=$row['name']?>">
                        <?=$row['name']?>
                    </a>
                </h2>
                <a href="<?=$curHost.utf8_to_ascii($parent=$parseokey[$row['parent_id']]!=''?$parseokey[$row['parent_id']]:$parname[$row['parent_id']])?>/<?=str_replace(array('--','--'), '-', utf8_to_ascii($name=$row['seo_key']!=''?$row['seo_key']:$row['name']))?>/1/<?=$row['id']?>.html" title="<?=$row['name']?>">
                    <?
                    if ($row['image_thumbs']){?>
                    <img class="img-news" src="<?=$curHost?><?=$row['image_thumbs']?>" title="<?=$row['name']?>" alt="<?=$row['name']?>" />
                    <?
                    }else{?>
                    <img src="<?=$curHost?>images/no_image.gif" alt="<?=$row['seo_key'] . " - " . $row["name"]?>"  class="img-news" style="display: inline;" title="<?=$row['name']?>" />
                    <? }?>
                </a>
                <div class="short-news">
                    <ul>
                    <?
                if ($properties){
                    foreach ($properties as $prop){?>
                        <li><label><?=$prop['cat']?>:&nbsp;</label><span><?=$prop['name']?></span></li>
                    <? }
                }else{?>
                        <li><label>đang cập nhật</label></li>
                    <? }?>
                    </ul>
                </div>
            </div>
                <?
                if ($num % 2 == 0){
                    echo '<div class="clear"></div></div><div class="block-news">';
                }

            }
        }
    }else{
        echo 'Hiện chưa có thông tin';
    }
    
}else{
    //Không nhập gì thì tự sướng quay về trang chủ
    $get_id_pro = getRecord('xteam_category','code="product"');
    echo '<script>window.location="'.$curHost.$get_id_pro['id'].'-'.utf8_to_ascii($get_id_pro['seo_key']).'/4-'.utf8_to_ascii($get_id_pro['name']).'.html";</script>';
}
?>
        </div>
<div class="cleared"></div>
<script language="javascript" type="text/javascript">
    $(document).ready(function(){
        var contentdiv = $('.block-news').text(function(){
            if ($.trim($(this).text())==''){
                $(this).hide();
            }
        });

    })
</script>